<?php
/*
 * Created on 28-04-2011
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 require_once("Entanglement.php");
 function Process($type, $payload){
 	switch($type){
 		case "PUBLICKEY":
 		  $e = Entanglement::GetFromUserId($payload);
 		  if($e == null){
 		  	return constant("NOT_ENTANGLED");
 		  }
 		  if($e->userAID == $payload){
 		  	if($e->userBID != null){
 		  		return constant("PARTNER_KEY").":$e->userBKey";
 		  	}else{
 		  		return constant("PARTNER_NOT_SYNCHED");
 		  	}
 		  }else{
 		  	return constant("PARTNER_KEY").":$e->userAKey";
 		  }
 		break;
 	}
 }
?>
